var latitude = window.webConnector.getLat();
var longitude = window.webConnector.getLong();
window.webConnector.checkdebug(latitude);
window.webConnector.checkdebug(longitude);

var map = L.mapbox.map('map', 'examples.map-20v6611k')
            .setView([latitude, longitude], 15);

var geoJson = [];

function loadMarker(){
    var jSonData = window.webConnector.getResult();

    var myObject = jQuery.parseJSON(jSonData);

    geoJson[0] = {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [longitude, latitude]
      },
      "properties": {
        "title": "Vị trí của mềnh",
        'marker-color': '#cc0033'
      }
    };

    jQuery.each(myObject, function(index, value) {
        geoJson[index+1] = {
          "type": "Feature",
          "geometry": {
            "type": "Point",
            "coordinates": [value['lng'], value['lat']]
          },
          "properties": {
            "title": value['address'],
            'marker-color': '#0099ff'
          }
        };
    });

    map.markerLayer.setGeoJSON(geoJson);
}
